package com.kolon.framework.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;


/**
 * CACHE 비우기 체크 인터셉터
 * @author stone
 *
 */
public class NoCacheInterceptor extends HandlerInterceptorAdapter {
	
	/**
	 * 컨트롤러 실행 전 호출되는 인터셉터 함수
	 */
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, 
			Object handler) throws Exception {
		response.setHeader("Cache-Control","no-store");   
		response.setHeader("Pragma","no-cache");   
		response.setDateHeader("Expires",0);   
		if (request.getProtocol().equals("HTTP/1.1")) response.setHeader("Cache-Control", "no-cache");
		return true;
	}

}
